function roo1(n1:number, n2:number):any{

}

function roo2(n1:number, n2:number,n3:string ):any{

}

function roo3(n1:number, n2:number,n3:string ,n4:boolean):any{

}

roo1(123,123)
roo2(123,123,'123')
roo3(1,2, '123', true)

function roo4(n1:number|string, n2:number|boolean):any{

}

roo4(1,2)
roo4('123', true)


type A = () => void;

//可调用注解,可以针对函数进行类型注解
type B = {
    ():void
}
let a:A = () => {};

//Z中函数参数可选
type Z = {
    (n:number):any
    username?:string
    age?:number
}

let w1:Z = (n) => {return n}
let w2:Z = (n,username?:string ,age?:number) => {return n}
let w3:Z = (n,username?:string) => {return n}


let z1:Z = function (n:number, username?:string ,age?:number):any{
    return n;
}

z1.username='123'
//z1.n = 1;

let z2:Z = (n) => {return n}
z2.username='123'
//z2.n = 1;

let z3:Z = (n:number, username?:string ,age?:number):number => {
    return n;
}

//D中函数都可以为D类型
type D = {
    (n:number , m:string):any
    (n:string , m:string):any
}

let d1:(n: number, m: string) => any = (n , m):any => {}
let d2:(n: string, m: string) => any = (n , m):any => {}
//D中函数都可以为D类型
d1(1,'123')
d2('1','123')

